﻿using System.Linq;
using NpCrm.DataAccess.Contracts;
using NpCrm.DataAccess.Core;
using NpCrm.Domain;

namespace NpCrm.DataAccess.Repositories
{
    public class AddressRepository : RepositoryBase<Address, int>, IAddressRepository
    {
        public IQueryable<Address> GetByCity(string city)
        {
            return Query(a => a.City.ToLower().IndexOf(city.ToLower()) > -1);
        }

        public IQueryable<Address> GetByPostalCode(string postalCode)
        {
            return Query(a => a.PostalCode.ToLower().IndexOf(postalCode.ToLower()) > -1);
        }
    }
}
